class Person(object):
    # 类属性
    count = 1


if __name__=='__main__':
    Person.count += 1
    p1 = Person()
    print(p1.count)

    pass

# if __name__ == '__main__':
#
#     # 方法1: 通过对象名.类属性名
#     p1 = Person()
#     print(p1.count)
#
#     # 方法2: 类名.属性名
#     print(Person.count)
#
#     # 举例子: 类属性被说有对象共有
#     p2 = Person()
#     print(p2.count)
#
#     # 修改类属性
#     p2.count += 1
#
#     print('*'*50)
#     print(p1.count)
#     print(p2.count)
#
#     print(Person.count)



